//
//  FinancialDetailCell.m
//  DaoZiJinFu
//
//  Created by woker on 16/6/23.
//  Copyright © 2016年 iwoker. All rights reserved.
//

#import "FinancialDetailCell.h"

@implementation FinancialDetailCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setUpCellWithModel:(HomeCellModel *)model {
    
    NSString *yieldStr = [NSString stringWithFormat:@"%.2lf",model.annual_gains*100];
    NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@%%",yieldStr]];
    NSDictionary *amountAttr = @{NSFontAttributeName:[UIFont systemFontOfSize:44.0f],NSForegroundColorAttributeName:ORANGECOLOR};
    NSDictionary *yuanAttr = @{NSFontAttributeName:[UIFont systemFontOfSize:14.0f],NSForegroundColorAttributeName:ORANGECOLOR};
    [attrStr setAttributes:amountAttr range:NSMakeRange(0, yieldStr.length)];
    [attrStr setAttributes:yuanAttr range:NSMakeRange(yieldStr.length, 1)];
    _yieldLab.attributedText = [[NSAttributedString alloc] initWithAttributedString:attrStr];
    
    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    formatter.numberStyle = kCFNumberFormatterDecimalStyle;
    _investableLab.text = [NSString stringWithFormat:@"%@元",[formatter stringFromNumber:[NSNumber numberWithDouble:model.remaining_investment_amount]]];
    _investDay.text = [NSString stringWithFormat:@"%.0lf天",model.day_number];
    
    
}

@end
